<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        //对象的简写形式有两种：属性名简写、方法简写

        let uname = '张三';
        let age = 19;
        let tel = 110;
        let obj = {uname:uname,age:age,tel:tel};
        console.log(obj);
         //属性名简写：当对象中的属性名与属性值同名时可以简写
         let obj2 = {uname,
            age,
            tel,
            //方法简写：直接省略冒号及function关键词
           // demo:function(){
            demo(){
                console.log('demo()方法');
            },
           // fn:function(){
            fn(){
                console.log('fn()方法');
            }
        };
         console.log(obj2);

         obj2.fn();
         obj2.demo()


       

    </script>
</head>
<body>
    
</body>
</html>